package Survey;

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.BorderFactory;
import javax.swing.JTextArea;

public class DModuleText extends DisplayModule {

	private static final long serialVersionUID = -9065806849494279049L;

	JTextArea answer;
	
	public DModuleText(SurveyParameters data, int index){
		super(data, index);
		
		answer = new JTextArea(data.dimensions[0], 40);
		answer.setMaximumSize(answer.getPreferredSize());
		answer.setBorder(BorderFactory.createLineBorder(Color.black));
		center.add(answer);
		
		setMaximumSize(new Dimension(DisplayGui.MODULEWIDTH, (20 + top.getPreferredSize().height + answer.getPreferredSize().height)));
		validate();
		repaint();
	}

	public String[] getData() {
		
		if(answer.getText() == null || answer.getText().trim().equals("")){
			return null;
		}
		
		return new String[]{answer.getText()};
	}	
}
